package com.dahua.strategy;

import com.dahua.strategy.version1.CashFactory;
import com.dahua.strategy.version1.CashSuper;
import org.junit.Before;
import org.junit.Test;

/**
 * @author sunhongguang
 * @create 2022-01-10-23:48
 */
public class StrategyTest1 {

    private int goodsNum;
    private double price;

    @Before
    public void before(){
        goodsNum = 2;
        price = 300;
    }

    @Test
    public void test1(){
        // 模拟客户端传递商品数量和
        CashSuper cashSuper = CashFactory.crateCashAccept("打8折");
        double acceptCash = cashSuper.acceptCash(price);
        System.out.println("原价为： "+goodsNum+"*"+price+"="+(goodsNum*price)+", 打折后的价格为："+goodsNum+"*"+acceptCash+"="+(goodsNum*acceptCash));
    }
}
